package com.example.project.Service.Impl;

import com.example.project.Dao.BlogDao;
import com.example.project.Dao.LikeDao;
import com.example.project.Entity.Like;
import com.example.project.Service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LikeServiceImpl implements LikeService {

    @Autowired
    private LikeDao likeDao;
    @Autowired
    private BlogDao blogDao;

    @Override
    public void addLike(Like like){
        likeDao.addLike(like);
        blogDao.addLikesNumber(like.getBlog_id());
    }

    @Override
    public void subLike(int user_id, int blog_id){
        likeDao.subLike(user_id, blog_id);
        blogDao.subLikesNumber(blog_id);
    }
}
